package cn.edu.nwsuaf.teachercenter.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import cn.edu.nwsuaf.teachercenter.service.LoginService;

@Controller
public class LoginController {
	@Resource(name="loginService")
	private LoginService loginService;
	
	@RequestMapping(value="/login",method=RequestMethod.POST)
	public String teacherLogin(@RequestParam(value="mno")String mno, 
			@RequestParam(value="mpassword")String mpassword, 
			ModelMap modelMap, HttpSession session){
			return loginService.login(mno, mpassword, modelMap, session);
	}
	
	@RequestMapping(value="/logout")
	public String teacherLogout(HttpSession session){
			return loginService.logout(session);
	}
}
